<template>
    <view>
        <view class="content" v-if="activityStatus == 1">
            <view class="tit">{{ lunbao.title }}</view>
            <view class="time">{{ lunbao.createTime }}</view>
            <rich-text :nodes="richConter" style="width: 100%"></rich-text>
        </view>
        <view v-if="activityStatus == 2">
            <view class="imagesize">
                <image class="upgrading" src="https://oos-cn.ctyunapi.cn/front-end/static/homeSub/images/activityStart.png" mode=""></image>
            </view>
            <view class="txt">
                <view class="txt1">
                    活动开始时间
                    <text class="fromDate">{{ lunbao.timeS }}</text>
                    敬请期待！
                </view>
            </view>
        </view>
        <view v-if="activityStatus == 3">
            <view class="imagesize">
                <image class="upgrading" src="https://oos-cn.ctyunapi.cn/front-end/static/homeSub/images/activityOver.png" mode=""></image>
            </view>
            <view class="txt">
                <view class="txt1">哎呀！来晚了，活动结束了~</view>
            </view>
        </view>
    </view>
</template>

<script>
'use strict';
var https_1 = require('./../../../api/https.js');

var app = getApp();
export default {
    data() {
        return {
            optionsID:'',
            richConter: '',
            activityStatus: null,
            lunbao: {},
        };
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        console.log(options)
        this.optionsID = options.id;

        this.infosFun()
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {
        let pathData = `/homeSub/pages/advertisDetails/advertisDetailsNew?id=${this.optionsID}`
        console.log(pathData,'pathData...')
        return {
            path: pathData
        }
    },
    methods: {
        //轮播图
        infosFun: function() {
            const that = this;
            let cityName = uni.getStorageSync('cityName') || uni.getStorageSync('currentCityName') || '全国';
            https_1
                .info({
                    sellerNo: app.globalData.sellerNo,
                    address: cityName
                })
                .then(res=> {
                    if (res.code == 0) {
                        var swiperItem_1 = res.data.indexAdvertising;
                        that.lunbao = swiperItem_1.find(item=>item.id == that.optionsID)
                        that.activityStatus = that.lunbao.status
                        that.richConter = that.lunbao.details.replace(/\<img/gi, '<img class="imgs"');

                        uni.setNavigationBarTitle({
                            title: that.lunbao.title
                        })
                    }

                    console.log(that.lunbao,'lunbao啊...')
                });
        },
    }
};
</script>
<style lang="less">
	@import url("./advertisDetails.less");
</style>
